<%@ page language="java" import="java.util.*,java.net.URLDecoder" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String loginName="";
String uid="";
Cookie[] cookArr = request.getCookies();
if(cookArr!=null){
	for(Cookie c:cookArr){
		if(c.getName().equals("LOGINNAME")){
			loginName = URLDecoder.decode(c.getValue(),"UTF-8");
		}
		if(c.getName().equals("UID")){
			uid = c.getValue();
		}
		c.getValue();
	}
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<title>地址列表</title>
<link rel="stylesheet" href="lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<style>
	.pic{
		width: 150px;
		height: 70px;
		margin-top: 0px;
		
	}
	.pic2{
		position: relative;
		width: 75px;
		height: 35px;
		left: 150px;
		top: -40px;
		font-size: 1.6em;
		color: #3B4249;
	}
	#td_n td{
		text-align: center;
	}
</style>
<script type="text/javascript">
</script>
</head>
<body class="pos-r">
	<div class="page-container">
		<div class="pic"><img src="../images/logo.png"></div>	
		<div class="pic2">地址列表</div>		
			<a class="btn btn-danger radius"  href="<%=basePath%>address/preAddBuyer_addr2.do?id=${id}"><i class="Hui-iconfont">&#xe600;</i> 添加地址</a>
			<div class="mt-20">
				<table class="table table-border table-bordered table-bg table-hover table-sort">
					<tbody>
						<c:if test="${list!=null }">
							<c:forEach items="${list}" var="addr">
								<tr id="td_n">
									<td>
						    			<c:if test="${addr.type==1 }">
							  				<c:out value="默认地址"></c:out>
							  			</c:if>
							  			${addr.name }&nbsp;&nbsp;${addr.phone}
				  					</td>
						    		<td rowspan="2">
						    			<input type="hidden" name="aid" value="${addr.aid}">
										 <a class="btn btn-primary radius" href="<%=basePath%>address/preEditAddr2.do?aid=${addr.aid}&id=${id}">编辑地址</a>
										 <a class="btn btn-primary radius" href="<%=basePath%>address/deleteAddr2.do?uid=${addr.uid}&aid=${addr.aid}&id=${id}">删除地址</a>
										 <a class="btn btn-primary radius"  href="<%=basePath%>orders/selectAddr2.do?aid=${addr.aid}&uname=<%=loginName%>&id=${id}">选定地址</a>
									</td>
								</tr>
								<tr >
		    						<td style="text-align: center;" >${addr.province }${addr.city }${addr.district}${addr.addr}</td>
		    					</tr>	
		  					</c:forEach>
						</c:if>
	    			</tbody>
				</table>
			</form>
		</div>
	</div>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
var setting = {
	view: {
		dblClickExpand: false,
		showLine: false,
		selectedMulti: false
	},
	data: {
		simpleData: {
			enable:true,
			idKey: "id",
			pIdKey: "pId",
			rootPId: ""
		}
	},
	callback: {
		beforeClick: function(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("tree");
			if (treeNode.isParent) {
				zTree.expandNode(treeNode);
				return false;
			} else {
				//demoIframe.attr("src",treeNode.file + ".html");
				return true;
			}
		}
	}
};		
$(document).ready(function(){
	var t = $("#treeDemo");
	t = $.fn.zTree.init(t, setting, zNodes);
	//demoIframe = $("#testIframe");
	//demoIframe.on("load", loadReady);
	var zTree = $.fn.zTree.getZTreeObj("tree");
	//zTree.selectNode(zTree.getNodeByParam("id",'11'));
});

$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[0,7]}// 制定列不参与排序
	]
});
</script>
</body>
</html>
